package com.seanzx.dp.entity;

import com.seanzx.dp.common.ColumnType;

public class Column {
    private String tableSchema;
    private String tableName;
    private String name;
    private ColumnType type;
    private int length;
    private String defaultValue;
    private String comment;
    private int index;

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private final Column column;
        private Builder() {
            column = new Column();
        }

        public Builder  tableSchema(String tableSchema) {
            column.tableSchema = tableSchema;
            return this;
        }

        public Builder tableName(String tableName) {
            column.tableName = tableName;
            return this;
        }

        public Builder name(String name) {
            column.name = name;
            return this;
        }

        public Builder type(ColumnType type) {
            column.type = type;
            return this;
        }

        public Builder length(int length) {
            column.length = length;
            return this;
        }

        public Builder comment(String comment) {
            column.comment = comment;
            return this;
        }

        public Builder index(int index) {
            column.index = index;
            return this;
        }

        public Column build() {
            return column;
        }
    }

    public String getTableSchema() {
        return tableSchema;
    }

    public void setTableSchema(String tableSchema) {
        this.tableSchema = tableSchema;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ColumnType getType() {
        return type;
    }

    public void setType(ColumnType type) {
        this.type = type;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    @Override
    public String toString() {
        return "Column{" +
                "tableSchema='" + tableSchema + '\'' +
                ", tableName='" + tableName + '\'' +
                ", name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", length=" + length +
                ", comment='" + comment + '\'' +
                ", index=" + index +
                '}';
    }
}
